import React from 'react'

import { 
    useParams,
    useLocation,
    useNavigate
} from "react-router-dom"

function withrouter(Com) {
    return (props) =>{
        const params = useParams()
        const location = useLocation()
        const navigate = useNavigate()

        return <Com {...props} router={{params,location,navigate}}/>
    }
}

export default withrouter

/*
    1.配置路由表
    2.跳路由
    3.根据路由id获取数据
    4.路由守卫
    5.封装withRouter
*/